#pragma once
#include <ECS/ECS.h>
#include <Box2D/Box2D.h>
#include <vector>
#include "Transform.h"

struct SimpleBodyDef
{
	b2BodyType type;
	std::vector<b2FixtureDef*> fixtures;

	b2FixtureDef* addBox(float width, float height, float xcenter = 0.0f, float ycenter = 0.0f, float angle = 0.0f);
	b2FixtureDef* addCircle(float radius, float xcenter = 0.0f, float ycenter = 0.0f);
};

class SimpleBody : public ECS::Component
{
	mtMETA_DEC;
public:
	SimpleBody();
	virtual ~SimpleBody();

	bool initWith(SimpleBodyDef* def);

	void onStart();

	void onUpdate();
protected:
	TransformClient* _tClient;
	b2Body* _body;
};